import sys
from os import write

# file = sys.stdout
# file.write('hello')
# print('world')

file = open('test.txt', 'rb') # rb二进制
print(file.read(1))
print(file.read(1))
print(file.tell())
print(file.seek(2,1))  # 返回当前位置




# #不需要写 close
# with open('test.txt', 'r',encoding='utf-8') as file2:
#     list2 = file2.readlines() # 返回一个列表
#     print(list2)
#
# str = "day day up"
# with open('test.txt', 'w',encoding='utf-8') as file3:
#    file3.write(str) #写入，会覆盖
#
# list3 = ['hello11', 'world22']
# with open('test.txt', 'a',encoding='utf-8') as file4:
#    file4.writelines(list3)
#
# #编码方式  语言  字符数   字节数
# #UTF-8   中文   1       3

